package com.ict.utils;


public class MessageStruct {

    private String routingKey;
    private int messageLength;
    private byte[] messageDetail;     // protobuf 后的消息数据

    public MessageStruct(String routingKey,byte[] messageDetail){
        this.routingKey = routingKey;
        this.messageLength = messageDetail.length;
        this.messageDetail = new byte[messageLength];

        // arraycopy(源数组,源数组要复制的起始位置,目的数组,目的数组放置的起始位置,复制的长度)
        /*
        * 实现数组的复制
        * */
        System.arraycopy(messageDetail,0,this.messageDetail,0,messageLength);
    }

    public String getRoutingKey(){
        return routingKey;
    }

    public byte[] getDetailMessage(){
        return messageDetail;
    }
}
